/**
 * 
 */
package com.example.demo.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.example.demo.dao.CommentDao;
import com.example.demo.pojo.Comment;
import com.example.demo.service.CommentService;

/**
 * @author Luigi
 *
 */
@Service
public class CommentServiceImpl implements CommentService {

	@Autowired
	CommentDao commentDao;
	@Override
	public void add(Comment comment) {
		// TODO Auto-generated method stub
		commentDao.save(comment);
	}

	@Override
	public void remove(Integer id) {
		// TODO Auto-generated method stub
		commentDao.deleteById(id);
	}

	@Override
	public void modify(Comment comment) {
		// TODO Auto-generated method stub
		commentDao.saveAndFlush(comment);
	}

	@Override
	public List<Comment> findAll() {
		// TODO Auto-generated method stub
		List<Comment> list = commentDao.findAll();
		return list;
	}

	@Override
	public Comment find(Integer id) {
		// TODO Auto-generated method stub
		Comment comment = commentDao.findById(id).get();
		return comment;
	}

}
